$number
= Input ( <max
digits>, [wait in seconds], [enter key], [esc key], [mask]
)
Accepts input from the telephone keypad and through speech recognition.
Parameters
<max
digits> Maximum number of digits allowed to enter by the user.
[wait
in seconds] Duration in seconds to wait for inputs. If this parameter is 2, the IVR will wait for a maximum of 2 seconds to get the input from the user. This countdown value will be reset after each input.
[enter
key] The key to be pressed by the user on completing the input.
[esc
key] Key pressed by the user for canceling the previous value entered.
[mask]
This optional argument is used for
filtering the input. The default mask is "0123456789".
Return Value
Returns the entered value/recognized word.
Remarks
- The input() will accept
a maximum of <max digits> numbers entered through the telephone keypad or when recognized through speech with the Xtend IVR waiting for a duration of [wait in seconds] between two consecutive inputs or until the [enter key] is pressed. The function returns the entered value/recognized word.
- The pre-defined variable $InputMode recognizes the mode of Input() operation. The mode of input operation can be classified into pulse (P), tone (T) and speech recognition (S).
Example
1) When mode of input() is through telephone keypad:
MAIN:
answer
Play "Welcome.wav"
$num = Input(2,3,#,*,"02468")
Play "YouEntered.wav"
Play Num2Wav($num)
Hangup
goto MAIN
- Here Input() waits for 2
digits to be entered or a 3-second delay with no key press, which
ever is earlier. Pressing # acts as the <Enter> key and
pressing * will erase the previously pressed keystrokes, allowing
re-entry. Input() will accept only even numbers,
since it is masked with "02468".
2) When mode of input() is through speech recognition:
MAIN:
answer
//Enable grammar and set the words to be recognized
.....
$retry = 3
while $retry > 1
$retry -= 1
//Accept a number between 0 - 9
play "song.wav"
while true
$Key = input(1,7)
if $InputMode == "S"
if srConfidence() >= 100
break
endif
else
break
endif
endwhile
if $InputMode == "S"
//Perform a translation to the appropriate keypress
.....
endif
.....
endwhile
play "thank.wav"
hangup
goto MAIN
- Here Input() waits till a word is recognized or a 7-second delay with no key press, which
ever is earlier. If mode of input is through speech recognition then compare the recognized word with the defined words and play the
corresponding wave file.
See also Accept()